package com.dx.controller;
import com.dx.domain.QaOperLog;
import com.dx.result.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import com.dx.service.LogService;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

@RestController
@RequestMapping("/log")
@RequiredArgsConstructor
@Api(tags = "日志管理")
public class LogController {
    private final LogService logService;
    @ApiOperation("添加日志")
    @PostMapping("/add")
    public R<?> add(@RequestBody QaOperLog log ){
        logService.add(log);
        return R.success();
    }
    @ApiOperation("查询日志")
    @PostMapping("/list")
    public R<?> list(String question, Long createdBy, LocalDateTime startTime, LocalDateTime endTime, Integer pageNum, Integer pageSize){
        return R.success(logService.list(question,createdBy,startTime,endTime,pageNum,pageSize));
    }
}
